class File
  rdl_nowrap

  type 'self.absolute_path', '(String file, ?String dir) -> String abs_file'
  type 'self.atime', '(%path or IO file) -> Time'
  type 'self.basename', '(String file, ?String suffix) -> String base_name'
  type 'self.birthtime', '(%path or IO file) -> Time'
  type 'self.blockdev?', '(String or IO file) -> %bool'
  type 'self.chardev?', '(String or IO file) -> %bool'
  type 'self.chmod', '(Fixnum mode, *String files) -> Fixnum'
  type 'self.chown', '(Fixnum owner, Fixnum group, *String files) -> Fixnum'
  type 'self.ctime', '(%path or IO file) -> Time'
  type 'self.delete', '(*String files) -> Fixnum'
  type 'self.directory?', '(String or IO file) -> %bool'
  type 'self.dirname', '(String file) -> String dir'
  type 'self.executable?', '(String file) -> %bool'
  type 'self.executable_real?', '(String file) -> %bool'
  type 'self.exist?', '(%path or IO file) -> %bool'
  # exists? deprecated
  type 'self.expand_path', '(%path file, ?%path dir) -> String abs_file'
  type 'self.extname', '(String path) -> String'
  type 'self.file?', '(String or IO file) -> %bool'
  type 'self.fnmatch', '(String pattern, String path, ?Fixnum flags) -> %bool'
  rdl_alias :fnmatch?, :fnmatch
  type 'self.ftype', '(String file) -> String' # TODO: return in set of strings
  type 'self.grpowned?', '(String or IO file) -> %bool'
  type 'self.identical?', '(String or IO file_1, String or IO file_2) -> %bool'
  type 'self.join', '(*(%path or File)) -> String'
  type 'self.lchmod', '(Fixnum mode, *String files) -> Fixnum'
  type 'self.lchown', '(Fixnum owner, Fixnum group, *String files) -> Fixnum'
  type 'self.link', '(String old, String new) -> 0'
  type 'self.lstat', '(String file) -> File::Stat'
  type 'self.mtime', '(%path or IO file) -> Time'
  type 'self.new', '(String file, ?String mode, ?String perm, ?Fixnum opt) -> File'
  type 'self.open', '(%path file, ?String file, ?String perm, ?Fixnum opt, mode:?String, external_encoding: ?String, internal_encoding: ?String, encoding: ?String, textmode: ?%any, binmode: ?%any, autoclose: ?%any) -> File'
  type 'self.open', '(%path file, ?String mode, ?String perm, ?Fixnum opt, mode:?String, external_encoding: ?String, internal_encoding: ?String, encoding: ?String, textmode: ?%any, binmode: ?%any, autoclose: ?%any) { (File) -> t } -> t'
  type 'self.owned?', '(String file) -> %bool'
  type 'self.path', '(String path) -> String'
  type 'self.pipe?', '(String file) -> %bool'
  type 'self.readable?', '(String file) -> %bool'
  type 'self.readable_real?', '(String file) -> %bool'
  type 'self.readlink', '(String link) -> String file'
  type 'self.readldirpath', '(String pathname, ?String dir) -> String real_pathname'
  type 'self.realpath', '(String pathname, ?String dir) -> String real_pathname'
  type 'self.rename', '(String old, String new) -> 0'
  type 'self.setgid?', '(String file) -> %bool'
  type 'self.setuid?', '(String file) -> %bool'
  type 'self.size', '(String or IO file) -> Fixnum'
  type 'self.size?', '(String or IO file) -> Fixnum or nil'
  type 'self.socket?', '(String or IO file) -> %bool'
  type 'self.split', '(String file) -> [String, String]'
  type 'self.stat', '(%path file) -> File::Stat'
  type 'self.sticky?', '(String file) -> %bool'
  type 'self.symlink', '(String old, String new) -> 0'
  type 'self.symlink?', '(String file) -> %bool'
  type 'self.truncate', '(String file, Fixnum) -> 0'
  type 'self.umask', '(?Fixnum) -> Fixnum'
  rdl_alias :unlink, :delete
  type 'self.utime', '(Time atime, Time mtime, *String files) -> Fixnum'
  type 'self.world_readable?', '(String or IO file) -> Fixnum or nil'
  type 'self.world_writable?', '(String or IO file) -> Fixnum or nil'
  type 'self.writable?', '(String file) -> Fixnum or nil'
  type 'self.writable_real?', '(String file) -> Fixnum or nil'
  type 'self.zero?', '(String or IO file) -> Fixnum or nil'

  type :atime, '() -> Time'
  type :birthtime, '() -> Time'
  type :chmod, '(Fixnum mode) -> 0'
  type :chown, '(Fixnum owner, Fixnum group) -> 0'
  type :ctime, '() -> Time'
  type :flock, '(Fixnum) -> 0 or %bool'
  type :lstat, '() -> File::Stat'
  type :mtime, '() -> Time'
  type :path, '() -> String file'
  type :size, '() -> Fixnum'
  rdl_alias :to_path, :path
  type :truncate, '(Fixnum) -> 0'

  class Stat
    rdl_nowrap

    type 'self.new', '(String file) -> File::Stat'
    type :<=>, '(File::Stat other) -> -1 or 0 or 1 or nil'
    type :atime, '() -> Time'
    type :birthtime, '() -> Time'
    type :blksize, '() -> Fixnum or nil'
    type :blockdev?, '() -> %bool'
    type :blocks, '() -> Fixnum or nil'
    type :chardev?, '() -> %bool'
    type :ctime, '() -> Time'
    type :dev, '() -> Fixnum'
    type :dev_major, '() -> Fixnum'
    type :dev_minor, '() -> Fixnum'
    type :directory?, '() -> %bool'
    type :executable?, '() -> %bool'
    type :executable_real?, '() -> %bool'
    type :file?, '() -> %bool'
    type :ftype, '() -> String'
    type :gid, '() -> Fixnum'
    type :grpowned?, '() -> %bool'
    type :ino, '() -> Fixnum'
    type :inspect, '() -> String'
    type :mode, '() -> Fixnum'
    type :mtime, '() -> Time'
    type :nlink, '() -> Fixnum'
    type :owned?, '() -> %bool'
    type :pip?, '() -> %bool'
    type :rdev, '() -> Fixnum or nil'
    type :rdev_major, '() -> Fixnum'
    type :rdev_minor, '() -> Fixnum'
    type :readable?, '() -> %bool'
    type :readable_real?, '() -> %bool'
    type :setgid?, '() -> %bool'
    type :setuid?, '() -> %bool'
    type :size, '() -> Fixnum'
    type :socket?, '() -> %bool'
    type :sticky?, '() -> %bool'
    type :symlink?, '() -> %bool'
    type :uid, '() -> Fixnum'
    type :world_readable?, '() -> Fixnum or nil'
    type :world_writable?, '() -> Fixnum or nil'
    type :writable?, '() -> %bool'
    type :writable_real?, '() -> %bool'
    type :zero?, '() -> %bool'
  end
end
